<template>
  <div id="app">
    <div id="nav" v-show="$route.meta.navShow">
      <router-link to="/">
        <p><van-icon name="wap-home-o" /></p>
        <p>首页</p>
      </router-link>
      <router-link to="/class">
        <p><van-icon name="apps-o" /></p>
        <p>分类</p>
      </router-link>
      <router-link to="/shoppingcar">
        <p><van-icon name="shopping-cart-o" /></p>
        <p>购物车</p>
      </router-link>
      <router-link to="/mine">
        <p><van-icon name="manager-o" /></p>
        <p>我的</p>
      </router-link>
    </div>
    <router-view/>
  </div>
</template>
<script>
	export default {
		name: 'home',
		data() {
			return {};
		},
		methods: {},
		beforeCreate() {
			window.onload = window.onresize = function() {
				document.documentElement.style.fontSize = (20 * document.documentElement.clientWidth) / 750 + 'px';
			};
			const innerHeight = window.innerHeight;
			window.addEventListener('resize', () => {
				const newInnerHeight = window.innerHeight;
				if (innerHeight < newInnerHeight) {
					document.activeElement.blur();
				}
			});
			document.onkeydown = function(event) {
				var e = event || window.event;
				if (e.keyCode === 13) {
					document.activeElement.blur();
				}
			};
		}
	};
</script>
<style lang="less">
@import './assets/css/reset.css';
*{
  margin: 0;
  padding: 0;
}

body{
  position: relative;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

#nav {
  width: 100%;
  position: fixed;
  height: 5rem;
  background: #fefcfd;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
  z-index: 99999;

  a {
    flex: 1;
    height: 5rem;
    // line-height: 5rem;
    text-align: center;
    font-weight: bold;
    color: #606060;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;

    p{
      width: 100%;

      &:first-child{
        height: 2.75rem;
        line-height: 4rem;
        font-size: 2rem;
      }

      &:last-child{
        height: 2.25rem;
        line-height: 2.25rem;
      }
    }

    &.router-link-exact-active {
      color: #ed5051;
    }
  }
}
</style>
